/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */

package com.mintandleaf.webkits.validator;

import org.apache.commons.validator.UrlValidator;

/**
 *
 * @author teguhh
 */
public class UrlAddressValidator extends BaseValidator{

    /**
     * Construct UrlAddressValidator with standard message
     */
    public UrlAddressValidator(){
        setErrorMessage("It's not valid url address");
    }
    /**
     * Construct UrlAddressValidator with custom message
     * @param custom error message
     */
    public UrlAddressValidator(String paramErrorMessage){
        setErrorMessage("It's not valid url address");
    }

    /**
     * Validate url addresss we are using standard schema
     * must containg http:// or https:// or ftp://
     * @param value address to be validate
     * @return true on successfull vaklidation /false if invalid url address
     */
    @Override
    public boolean validate(Object value) {
        UrlValidator defaultValidator = new UrlValidator(); // default schemes
        return defaultValidator.isValid(String.valueOf(value));

      }


}
